<html>
    <head>
		<meta charset="utf-8" />
		<title>canvas test</title>
	</head>
	<body style="background-color: red;">
		<div style="text-align:center;">
			<canvas id="game" width="400px" height="200px">your browser can not support canvas label</canvas>
		</div>
		<script type="text/javascript">
		var img = new Image();
		img.src = "http://avatar.csdn.net/3/B/2/1_hursing.jpg";
		img.onload = function() {
			var mainCanvas = document.getElementById("game");
			var mainContext = mainCanvas.getContext("2d");
			var cacheCanvas = document.createElement("canvas");
			var context = cacheCanvas.getContext("2d");
			context.drawImage(img, 0, 0, img.width, img.height);
			mainContext.drawImage(cacheCanvas, 0, 0, 140, 140);
			delete this;
		}
		</script>
	</body>
</html>